#include "myhead.h"
#include "def.h"
void dodir(char* path)
{
	DIR* dp;
	struct dirent* dirnode;
	if ((dp=opendir(path))!=NULL)
	{
		while ((dirnode=readdir(dp))!=NULL)
		{
			printf("%s\n", dirnode->d_name);
		}
	}
	else
	{
		printf("The directory %s does not exist\n", path);
	}
}
void listDir(char* params[], int paramNumber)
{
	if (paramNumber!=1&&paramNumber!=2)
	{
		printf(helpStr);
	}
	else
	{
		if (paramNumber==1)
		{
			dodir(".");
		}
		else
		{
			dodir(params[1]);
		}
	}
}
